Page({
  data: {
    statusBarHeight: 0,
    navbarHeight: 0
  },

  onLoad() {
    // 获取系统信息，用于适配状态栏高度
    try {
      const systemInfo = wx.getSystemInfoSync()
      const statusBarHeight = systemInfo.statusBarHeight || 0
      const navbarHeight = 88 // 导航栏高度，单位rpx，转换为px
      
      this.setData({
        statusBarHeight: statusBarHeight,
        navbarHeight: statusBarHeight + (navbarHeight * systemInfo.windowWidth / 750)
      })
    } catch (e) {
      console.error('获取系统信息失败:', e)
      this.setData({
        statusBarHeight: 0,
        navbarHeight: 0
      })
    }
  },

  // 返回
  goBack() {
    const pages = getCurrentPages()
    if (pages.length > 1) {
      wx.navigateBack()
    } else {
      wx.navigateTo({
        url: '/pages/withdraw/withdraw'
      })
    }
  }
})

